#include "Precomp.h"
#include "AllBindings.h"
#include "SQGame.h"
#include "Map.h"
#include "ResourceManager.h"
#include <PhysFS++.h>

DECLARE_INSTANCE_TYPE_NOCOPY(Map);

void bindGame()
{
	SQGame& game=SQGame::getInstance();
	SQClassDef<Map>(L"Map")
		.func(&Map::saveToFile,L"save")
		.func(&Map::reload,L"reload");
	RegisterGlobal(game,&SQGame::getCurrentMap,L"getCurrentMap");
	RegisterGlobal(game,&SQGame::getFrameTime,L"getFrameTime");
	RegisterGlobal(game,&SQGame::setDesiredFPS,L"setDesiredFPS");
	RegisterGlobal(game,&SQGame::end,L"endGame");
	RegisterGlobal(game,&SQGame::setCurrentMap,L"switchMap");
	RegisterGlobal(game,&SQGame::setEditMode,L"setEditMode");
	ResourceManager& resmgr=game.getResourceManager();
	RegisterGlobal(resmgr,&ResourceManager::loadMap,L"loadMap");
	RegisterGlobal(resmgr,&ResourceManager::unloadMap,L"unloadMap");
	PhysFS::VFSManager& instance=PhysFS::VFSManager::getInstance();
	RegisterGlobal(instance,&PhysFS::VFSManager::wmount,L"mount");
	RegisterGlobal(instance,&PhysFS::VFSManager::wunmount,L"unmount");
}